package com.zwps.common.controller.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j;
import com.zwps.common.controller.constant.SwaggerConstant;

@EnableWebMvc
@EnableKnife4j
@Configuration
public class CustomSwaggerConfig implements WebMvcConfigurer {

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        // opend api 文档需要映射前端资源
        registry.addResourceHandler(SwaggerConstant.ANT_PATH_SWAGGER_UI_HTML)
                .addResourceLocations("classpath:/META-INF/resources/");
        registry.addResourceHandler(SwaggerConstant.ANT_PATH_DOC_HTML)
                .addResourceLocations("classpath:/META-INF/resources/");
        registry.addResourceHandler(SwaggerConstant.ANT_PATH_WEBJARS)
                .addResourceLocations("classpath:/META-INF/resources/webjars/");
    }

}
